<?php
$pic_name = "1.jpg";
$name_tmp = $cat_pic_real;


require  'common/qiniu/autoload.php';

$accessKey = C("qiniu.accessKey");
$secretKey = C("qiniu.secretKey");
$bucket = C("qiniu.bucket");
    // 初始化签权对象
    $auth = new Auth($accessKey, $secretKey);
    // 生成上传Token
    $token = $auth->uploadToken($bucket);

    // 构建 UploadManager 对象
    $uploadMgr = new UploadManager();


    //上传
    list($ret, $err) = $uploadMgr->putFile($token, $pic_name, $name_tmp);


    if ($err !== null) {
        var_dump($err);
    } else {
        var_dump($ret);
        echo '图片地址为：<a target="_blank" href="http://oktvu3l78.bkt.clouddn.com/' . $ret['key'] . '">' . $ret['key'] . '</a>';
    }